package com.craiglarman.monopoly.domain;

public class TaxSquare implements ISquare {
	
	final static float MAX_TAX_AMOUNT = 200;
	
	@Override
	public void onLanding(Player p) {
		float newCashAmount = calculateTax(p.getNetWorth());
		p.adjustCash(newCashAmount);
	}

	private float calculateTax(float playerCashAmount) {
		float taxAmount = (playerCashAmount*10)/100;
		if (taxAmount>MAX_TAX_AMOUNT) {
			return -(MAX_TAX_AMOUNT);
		} else {
			return -(taxAmount);
		}		
	}	

}
